<?
include("common/header.html");
include("common/left.html");
include("common/page.php");
include("common/billcommon.php");
$r=array();
$status=array();
if ($_GET['about'] && $_GET['about']=='pay') {
    $where = "where fid={$_SESSION['sid']} and orders<>0";
} else {
    $where="where aid={$_SESSION['sid']} and orders<>0";
}

if($_REQUEST['btime']){
	$where.=" and etime>='".$_REQUEST['btime']." 00:00:00'";
}
if($_REQUEST['etime']){
	$where.=" and etime<='".$_REQUEST['etime']." 23:59:59'";
}
if(isset($_REQUEST['status'])){
	$status=$_REQUEST['status'];
	$where.=" and status in (".implode(",",$status).")";
}
if ($_GET['btype']==1) {
    $h3Title="在线支付账单";
    $where .= " AND btype=1";//现场支付账单
    $btype = 1;
}
else {
    $h3Title="现场支付账单";
    $where .= " AND btype=0";//现场支付账单
    $btype = 0;
}

$pageSize=$_REQUEST['pageSize']?$_REQUEST["pageSize"]:15;
$currentPage=$_REQUEST["currentPage"]?$_REQUEST["currentPage"]:1;
$offset=($currentPage-1)*$pageSize;

$str="SELECT id, fid, aid, btime, etime, orders, tnums, money, addtime, ctime,".
    " btype,payoff, `status` FROM uu_bill_offline $where LIMIT $offset,$pageSize";
//echo $str;
$GLOBALS['le']->query($str);
while($row=$GLOBALS['le']->fetch_assoc()){
	$r[]=$row;
}
$str="select count(*) as num from uu_bill_offline $where";
$GLOBALS['le']->query($str);
$GLOBALS['le']->fetch_assoc();
$count = $GLOBALS['le']->f("num");
$about="get";
include("tpl/bill_offline.tpl");
include("common/footer.html");
?>